import 'package:blog/base/get/get_save_state_view.dart';
import 'package:blog/ui/page/complex_module/music_page/widget/music_item_widget.dart';
import 'package:blog/widget/Music.dart';
import 'package:blog/widget/WideCard.dart';
import 'package:blog/widget/pull_smart_refresher.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'music_controller.dart';

/// @class : ProjectPage
/// @date : 2021/08/23
/// @name : CTGU_LLZ(404name)
/// @description :项目 View层
class MusicPage extends GetSaveView<MusicController> {
  const MusicPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        top: true,
        child: RefreshWidget<MusicController>(
          child: ListView(

            children: [
              SizedBox(height: 15,),
              controller.audioApp,
              Container(
                height: 200,
                child: new Swiper(
                  itemBuilder: (BuildContext context, int index) {
                    return InkWell(
                        child: WideCard(label: controller.topCardList[index].musicName, imgStr: controller.topCardList[index].imgUrl, isLocal: false,),
                        onTap: (){
                          controller.nowIdex = index;
                          controller.updateMusic();
                        }
                    );
                  },
                  itemCount: controller.topCardList.length,
                  viewportFraction: 0.8,
                  scale: 0.9,
                ),
                padding: EdgeInsets.all(10),
              ),

              ]
            ),
        ),
      ),
    );
  }
}
